/*
 * 创建用户：mleo
 * 项目名称：demo
 * 模块名称：demo
 * 文件名称：MyThread
 * 修改时间：2017/11/14 14:56:04
 * Copyright (c) 2017.
 */

package com.ichochy.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MyThread {

    private MyThread(){}
    private static MyThread myThread = new MyThread();

    public static MyThread getInstance(){
        return myThread;
    }


    public static void main(String[] args) {
        ExecutorService executors = Executors.newCachedThreadPool();
        for (int i = 0; i < 1000; i++) {
            executors.execute(getInnerClass());

        }
    }



    private static InnerClass getInnerClass(){
        return getInstance().new InnerClass();
    }

    public class InnerClass implements Runnable{


        @Override
        public void run() {
            System.out.println(Thread.currentThread().getName()+"######");
        }
    }



}
